home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / FileView.java < prev    next >
Text File  |  1998-06-30  |  3KB  |  94 lines

  1. /*
  2.  * @(#)FileView.java    1.3 98/04/14
  3.  * 
  4.  * Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.swing.preview.filechooser;
  22.  
  23. import java.io.File;
  24. import com.sun.java.swing.*;
  25. import com.sun.java.swing.preview.*;
  26.  
  27. /**
  28.  * FileView defines an abstract class that can be implemented to
  29.  * provide the filechooser with ui information for a File.
  30.  *
  31.  * Each L&F JFileChooserUI object implements this class to pass
  32.  * back the correct icons and type descriptions specific to
  33.  * that L&F. For example, the Windows L&F returns the generic Windows
  34.  * icons for directories and generic files.
  35.  *
  36.  * Additionally, you may want to provide your own FileView to
  37.  * JFileChooser to return different icons or additional information. 
  38.  *
  39.  * @see JFileChooser#setFileView
  40.  * @see JFileChooser#setFileView
  41.  *
  42.  * JFileChooser first looks to see if there is a user defined FileView,
  43.  * if there is, it gets type information from there first. If FileView
  44.  * returns null for any method, JFileChooser then uses the L&F specific
  45.  * view to get the information.
  46.  *
  47.  * So, for example, if you provide a FileView class that returns an
  48.  * <code>Icon<code> for JPG files, and returns <code>null<code>
  49.  * icons for all other files, the UI's FileView will provide default
  50.  * icons for all other files.
  51.  *
  52.  * @see JFileChooser
  53.  * @see ExtensionBasedFileView (NOTE: ExtensionBasedFileFilter is currently
  54.  *      located in the FileChooserDemo directory. The next Swing release
  55.  *      (Swing 1.0.3) will move this into the filechooser pakcage).
  56.  *
  57.  * @version 1.3 04/14/98
  58.  * @author Jeff Dinkins
  59.  *
  60.  */
  61. public abstract class FileView {
  62.     /**
  63.      * The name of the file. Normally this would be simply f.getName()
  64.      */
  65.     public abstract String getName(File f);
  66.  
  67.     /**
  68.      * A human readable description of the file. For example,
  69.      * a file named jag.jpg might have a description that read:
  70.      * "A JPEG image file of James Gosling's face"
  71.      */
  72.     public abstract String getDescription(File f);
  73.  
  74.     /**
  75.      * A human readable description of the type of the file. For
  76.      * example, a jpg file might have a type description of:
  77.      * "A JPEG Compressed Image File"
  78.      */
  79.     public abstract String getTypeDescription(File f);
  80.  
  81.     /**
  82.      * The icon that represents this file in the JFileChooser.
  83.      */
  84.     public abstract Icon getIcon(File f);
  85.  
  86.     /**
  87.      * Whether the directory is traversable or not. This might be
  88.      * useful, for example, if you want a directory to represent
  89.      * a compound document and don't want the user to descend into it.
  90.      */
  91.     public abstract Boolean isTraversable(File f);
  92.  
  93. }
  94.